<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>解构赋值</title>
</head>
<body>
    <script>
        let arr = ['xiasnn',4223];
        // let name = arr[0];
        // let age = arr[1];
        let [name,age] = arr;
        console.log(name,age);


        function get(){
            return ['xiaxia',123];
        }
        let [name1,age1] = get();
        console.log(name1,age1);


        let [...arr1] = 'xiasnn';
        console.log(arr1);


        let arr3 = ['abcdef',1997];
        let [,year] = arr3;
        console.log(year);


        let [name4,...args] = ['aaa','bbb','ccc','ddd'];
        console.log(args);

        let args1 = [1,2,3,4,5];
        let a = ['eee',...args1];
        console.log(a);


        let [name5,age5 = 8] = ['大美女'];
        console.log(name5,age5);


        // function show([...args2]){
        function show(args2){
            console.log(args2);
        }
        show(['bshbvhas',689566]);
    </script>
</body>
</html>